@extends('layouts.header')
@inject('sender','App\Http\Controllers\WroteitController')
@section('content')
<div style="text-align: center;">
    <h2>Outbox</h2>
    <form action="{{ route('new_message')}}" method="GET">
        <button type="submit">New message...</button>
    </form>
</div>
@foreach($messages as $message)
    @if (Auth::user()->id == $message->from_id)
        <h3 style="padding-top: 15px;"><a href="{{ route('show_message2',['mes'=>$message->id]) }} " title="Show message">{{$message->title}}</a></h3>
        <h5>sended to {{$sender::getReceiver($message)->name}} at {{$message->created_at}}</h5>                    
    @endif
@endforeach    
@endsection()